﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Form form = new Form();
            MyForm myform = new MyForm(form);
            form.ShowDialog();
        }
    }
    class MyForm : Form
    {
        private Form form;
        public MyForm(Form form)
        {
            if (form != null)
            {
                this.form = form;
                this.form.Click += this.Action;
            }
        }

        internal  void Action(object sender, EventArgs e)
        {
            this.form.Text = DateTime.Now.ToString();
        }
    }

}
